package ticketmachine.dataObjects;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import ticketmachine.logic.Promotion;

/**
 *
 * @author oiiv2253
 */
public class PromotionDAO implements IPromotionDAO{

    private HashMap <Integer,Promotion> promotionList;

    public PromotionDAO () {

        promotionList = new HashMap<Integer,Promotion>();
        
    }

    public Promotion getPromotionById(int id) {

        Promotion promo = promotionList.get(id);

        return promo;

    }

    public Collection<Promotion> listPromotions() {

        return promotionList.values();

    }

    public int createPromotion(String name, float discount, String valid_from, String valid_until, String discaountStrategyClass) {
        
    	int newId = promotionList.values().size();

        promotionList.put(newId, new Promotion(newId,discount,valid_from,valid_until,name,discaountStrategyClass));

        return newId;

    }

    

}
